package com.cb.spzx.manager;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.cb.spzx.manager.mapper.CategoryBrandMapper;
import com.cb.spzx.manager.mapper.SysUserMapper;
import com.cb.spzx.manager.mapper.SysUserRoleMapper;
import com.cb.spzx.model.entity.product.CategoryBrand;
import com.cb.spzx.model.entity.system.SysRoleUser;
import com.cb.spzx.model.entity.system.SysUser;
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.data.redis.core.RedisTemplate;

import java.util.List;
import java.util.concurrent.TimeUnit;

@SpringBootTest
public class test {
    @Autowired
    private SysUserMapper sysUserMapper;
    @Autowired
    private RedisTemplate<String,String> redisTemplate;
    @Autowired
    private SysUserRoleMapper sysUserRoleMapper;
    @Autowired
    private CategoryBrandMapper categoryBrandMapper;

    @Test
    public void test1(){
//        List<SysUser> sysUsers = sysUserMapper.seletALL();
//        System.out.println(sysUsers);
//        redisTemplate.opsForValue().set("cbcb","1234",1, TimeUnit.DAYS);
//        LambdaQueryWrapper<SysRoleUser> queryWrapper = new LambdaQueryWrapper<>();
//        queryWrapper.eq(SysRoleUser::getUserId,222);
//        Long count = sysUserRoleMapper.selectCount(queryWrapper);
//        System.out.println(count);
        Page<CategoryBrand> categoryBrandPage = new Page<>(1, 2);
        IPage<CategoryBrand> byPage = categoryBrandMapper.findByPage(categoryBrandPage, null);
        List<CategoryBrand> records = byPage.getRecords();
        System.out.println(records);
    }
}
